//gin路由配置

package routers

import (
	"fjj/tool/config"
	"github.com/gin-gonic/gin"
)

var cfg, _ = config.ParseConfig("app.json")

type Option func(engine *gin.Engine)

var options = []Option{}

//注册路由配置
func Include(opts ...Option) {
	options = append(options, opts...)
}

//初始化
func Init() *gin.Engine {
	r := gin.Default()
	for _, opt := range options {
		opt(r)
	}
	r.Run(cfg.AppPort)

	return r
}
